﻿Imports Microsoft.VisualBasic

Public Class BattleshipGameGrid
    Private m_PlayerGrid(10, 10) As BattleshipGridSquare
    Private m_PlayerNum As Integer
    Private m_IsTrackingGrid As Boolean
    Private m_IsFiringGrid As Boolean
    Private m_shipparkedonthisgridsquare_name As String

    Public Property PlayerGrid() As Array
        Get
            Return m_PlayerGrid
        End Get
        Set(ByVal value As Array)
            m_PlayerGrid = value
        End Set
    End Property

    Public Property PlayerNum() As Integer
        Get
            Return m_PlayerNum
        End Get
        Set(ByVal value As Integer)
            m_PlayerNum = value
        End Set
    End Property

    Public Property IsFiringGrid() As Boolean
        Get
            Return m_IsFiringGrid
        End Get
        Set(ByVal value As Boolean)
            m_IsFiringGrid = value
        End Set
    End Property

    Public Property IsTrackingGrid() As Boolean
        Get
            Return m_IsTrackingGrid
        End Get
        Set(ByVal value As Boolean)
            m_IsTrackingGrid = value
        End Set
    End Property

    'So we know what we're shooting when its on the other side!
    Public Property ShipName As String
        Get
            Return m_shipparkedonthisgridsquare_name
        End Get
        Set(ByVal value As String)
            m_shipparkedonthisgridsquare_name = value
        End Set
    End Property

    Public Sub New(ByVal PlayerNum As Integer, ByVal IsTrackingGrid As Boolean, ByVal IsFiringGrid As Boolean)
        Me.PlayerGrid(10, 10) = Nothing
        Me.PlayerNum = PlayerNum
        Me.IsTrackingGrid = IsTrackingGrid
        Me.IsFiringGrid = IsFiringGrid
        For x As Integer = 0 To 10
            For y As Integer = 0 To 10
                Me.PlayerGrid(x, y) = New BattleshipGridSquare
                Me.PlayerGrid(x, y).ShipExists = False
                Me.PlayerGrid(x, y).ShotState = 0
            Next y
        Next x

    End Sub

End Class
